<template>
	<view>
		<web-view :src="url"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url:""
			}
		},
		onLoad() {
			this.getConfig();
		},
		methods: {
			getConfig(){
				this.$_request(
					"GET","/api/fresns/v1/global/configs",
					{
						"keys":"account_center_service"
					},
					(res) => {
						let webViewUrl = res.data.data.account_center_service;
						const regex = /^(https?:\/\/[^/]+)(\/.*)$/i;
						webViewUrl = webViewUrl.replace(regex, (_, domainPart, pathPart) => `${this.$_url()}${pathPart}`);
						webViewUrl = webViewUrl.replace('{accessToken}', this.$_extensionPluginAccessToken());
						webViewUrl = webViewUrl.replace('{postMessageKey}', 'youransns');
						webViewUrl = webViewUrl.replace('{redirectUrl}', '');
						this.url = webViewUrl;
					}
				)
			},
		}
	}
</script>

<style>

</style>
